package com.util;

import java.io.File;

public class DelDir {

    public static boolean delAll(File file){
        if(!file.exists()){
            //throw....
            //System.out.println("文件不存在");
            return false;
        }
        if (!file.isDirectory()){
            file.delete();
            //System.out.println("删除文件" + file.getName());
        }else {
            File[] files = file.listFiles();
            for (int i = 0; i < files.length; i++) {
                delAll(files[i]);
            }
           //System.out.println("删除文件夹" + file.getAbsolutePath());
            file.delete();

        }
        return true;
    }

}
